//
//  MainViewController.m
//  lovergotest
//
//  Created by liudonghuan on 14-8-26.
//  Copyright (c) 2014年 liudonghuan. All rights reserved.
//

#import "LGUtil.h"
#import "MainViewController.h"
#import "MobClick.h"
@interface MainViewController ()

@end

@implementation MainViewController



- (void)viewDidLoad
{
    [super viewDidLoad];
    [self loaMainView];
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

-(void)loaMainView
{
    //尝试登陆
    NSUserDefaults *standard = [NSUserDefaults standardUserDefaults];
    NSString *uEmail = [standard objectForKey:@"UserEmail"];
    NSString *uPwd = [standard objectForKey:@"UserPwd"];
    if ( uEmail!= NULL && uPwd != NULL) {
        NSDictionary *para = [[NSDictionary alloc] initWithObjectsAndKeys:
                              uEmail,@"mobile",
                              uPwd,@"passWord",
                              nil];
        [[RequestManager getSingleton] sendRequestAboutUser:loginSPath para:para];
    }
    
    //推荐
    TuiJianHuoDongViewController *tjVCotroller = [[TuiJianHuoDongViewController alloc]init];
    UINavigationController *fNavController = [LGUtil getNavByType:TypeTuiJian controller:tjVCotroller];
    //收藏
    ShouCangViewController *scViewController = [[ShouCangViewController alloc]init];
    UINavigationController *sNavController = [LGUtil getNavByType:TypeShouCang controller:scViewController];
    //个人
    UserViewController *uViewContrller = [[UserViewController alloc]init];
    UINavigationController *tNavController = [LGUtil getNavByType:TypeGeRen controller:uViewContrller];
    
    self.viewControllers = [NSArray arrayWithObjects:fNavController,sNavController,tNavController,nil];
    [self.tabBarController.tabBar setSelectedImageTintColor:LGCOLOR_blue];
    
}
- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    [MobClick beginLogPageView:@"Main"];
}
- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
    [MobClick endLogPageView:@"Main"];
}

@end
